#include<stack>
#include<string>
#include<vector>
using namespace std;
class Solution {
public:
    int evalRPN(vector<string>& tokens) {
        stack<int>st;
        for (auto& e : tokens)
        {
            if (e == "*" || e == "-" || e == "/" || e == "+")
            {

                int x = st.top();
                st.pop();
                int y = st.top();
                st.pop();
                //
                switch (e[0]) {
                case '*':
                    st.push(x * y);
                    break;
                case '+':
                    st.push(x + y);
                    break;
                case '-':
                    st.push(y - x);
                    break;
                case '/':
                    st.push(y / x);
                    break;
                }

            }
            else
            {
                st.push(stoi(e));
            }

        }
        return st.top();
    }
};
int main()
{
    vector<string>ret{ "2","1","+","3","*" };
    Solution Q;
    Q.evalRPN(ret);
    return 0;
}